home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / misc / math / MathFX_src.lha / fxhrsh.c < prev    next >
C/C++ Source or Header  |  1995-12-20  |  1KB  |  52 lines

  1. /* Writes the Hershey symbol "ch" centred at the physical */
  2. /* coordinate (x,y) */
  3.  
  4. #include "mathfx.h"
  5.  
  6.  
  7.  
  8. void fxhrsh(ch,x,y)
  9. int ch, x, y;
  10. {
  11.       int cx, cy, k, penup;
  12.       short int xygrid[300];
  13.       float symdef, symht, scale, xscale, yscale, xpmm, ypmm;
  14.  
  15.       gsym(&symdef,&symht);
  16.       gpixmm(&xpmm,&ypmm);
  17.       k = 5;
  18.       penup = 1;
  19.       scale = 0.05 * symht;
  20.  
  21.       if (!fxcvec(ch,xygrid)) {
  22.         movphy(x,y);
  23.         return;
  24.       }
  25.       
  26.       /* Compute how many physical pixels correspond to a character pixel */
  27.  
  28.       xscale = scale * xpmm;
  29.       yscale = scale * ypmm;
  30.  
  31.       for(;;) {
  32.         cx = xygrid[k];
  33.         k = k+1;
  34.         cy = xygrid[k];
  35.         k = k+1;
  36.         if (cx == -64 && cy == -64) {
  37.           movphy(x,y);
  38.           return;
  39.         }
  40.         else if (cx == -64 && cy == 0) 
  41.           penup = 1;
  42.         else  {
  43.           if (penup != 0) {
  44.             movphy(round(x+xscale*cx),round(y+yscale*cy));
  45.             penup = 0;
  46.           }
  47.           else
  48.             draphy(round(x+xscale*cx),round(y+yscale*cy));
  49.         }
  50.       }
  51. }
  52.